# Maintainer: Oscar Fuentes <ofv@wanadoo.es>

_realname=tklib
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
_hash="29e6d0e6da"
# Increase every time we refresh the package with a new upstream hash:
_releasecounter=1
_basever=0.7.0
pkgver="$_basever+$_releasecounter.$_hash"
_dir="Tk_Library_Source_Code-$_hash"
pkgrel=1
pkgdesc="A companion to Tcllib, for Tk related packages (mingw-w64)"
arch=('any')
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}-git")
replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}-git")
url='https://core.tcl.tk/tklib/home'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-tk"
         "${MINGW_PACKAGE_PREFIX}-tcllib")
source=("https://core.tcl-lang.org/tklib/tarball/29e6d0e6da/$_dir.tar.gz")
sha256sums=('d9fae8f16b20cf9ccb4179977468cf6dff167ee2bfe230dee16f923f4bf09a6b')

build() {
  cd ${srcdir}/${_dir}
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}
  make all
}

package() {
  cd ${srcdir}/${_dir}
  make DESTDIR="${pkgdir}" install
  mkdir -p ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/
  cp license.terms ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
